package com.cheng.io.input;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * Test:FileInputStream
 *          int read(); 一次读取一个字节的数据，返回字符的ASCII码
 *          void close(); 关闭流
 */
public class FileInputStreamTest01 {
    public static void main(String[] args) {
        InputStream in = null;
        try {
            in = new FileInputStream("D:\\code\\java-study\\java-study\\io\\resources\\test01.txt");
            int read = 0;
            while ((read = in.read()) != -1) {
                System.out.println("read:" + read);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }
    }
}
